// ========================================================================= // ACRYLICWALA ULTIMATE DYNAMIC HOMEPAGE (FLATSOME NATIVE FONTS INHERITED) // ========================================================================= add_shortcode('acrylicwala_home', 'acrylicwala_dynamic_homepage_shortcode'); function acrylicwala_dynamic_homepage_shortcode() { $post_id = get_the_ID(); $html = ''; // 1. Dependencies & Styles $html .= ''; $html .= ''; $html .= ''; $html .= ''; // FLATSOME TYPOGRAPHY INHERIT FIX $html .= ''; $html .= ''; $html .= '
'; // 2. Slider $html .= '
'; $html .= '
'; if ( class_exists('ACF') && have_rows('hero_slider', $post_id) ) { while ( have_rows('hero_slider', $post_id) ) { the_row(); $image_array = get_sub_field('slide_image'); $img_url = is_array($image_array) ? $image_array['url'] : $image_array; $subtitle = get_sub_field('slide_subtitle'); $title = get_sub_field('slide_title'); $desc = get_sub_field('slide_description'); $btn_text = get_sub_field('button_text'); $btn_link = get_sub_field('button_link'); $html .= '
'; $html .= '
'; if( !empty($subtitle) ) { $html .= '' . esc_html($subtitle) . ''; } $html .= '

' . $title . '

'; if( !empty($desc) ) { $html .= '

' . esc_html($desc) . '

'; } if( !empty($btn_text) && !empty($btn_link) ) { $html .= '' . esc_html($btn_text) . ''; } $html .= '
'; $html .= '
'; if( !empty($img_url) ) { $html .= ''; } $html .= '
'; } } else { $shop_link = function_exists('wc_get_page_permalink') ? esc_url(wc_get_page_permalink('shop')) : '#'; $html .= '
Premium Quality

Custom Acrylic Prints

Turn your favorite memories into stunning wall art. Crystal clear, shatterproof, and ready to hang.

Customize Now
'; } $html .= '
'; // 3. Categories $html .= '

Shop By Category

'; if ( function_exists('WC') ) { $prod_cats = get_terms(array('taxonomy' => 'product_cat', 'hide_empty' => false, 'number' => 4, 'parent' => 0)); if ( !empty($prod_cats) && !is_wp_error($prod_cats) ) { foreach ( $prod_cats as $cat ) { $thumbnail_id = get_term_meta($cat->term_id, 'thumbnail_id', true); $image_url = wp_get_attachment_url($thumbnail_id); if ( !$image_url ) { $image_url = wc_placeholder_img_src(); } $html .= ' ' . esc_attr($cat->name) . '

' . esc_html($cat->name) . '

'; } } } $html .= '
'; // 4. Trending Products $html .= '

Trending Products

'; if ( function_exists('WC') ) { $args = array('post_type' => 'product', 'posts_per_page' => 4, 'post_status' => 'publish'); $loop = new WP_Query($args); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) { $loop->the_post(); $_product = wc_get_product( get_the_ID() ); if( $_product ) { $img_url = wp_get_attachment_image_url($_product->get_image_id(), 'large'); if ( !$img_url ) { $img_url = wc_placeholder_img_src(); } $html .= '
' . esc_attr(get_the_title()) . ' ' . get_the_title() . '
' . $_product->get_price_html() . '
Customize It
'; } } wp_reset_postdata(); } } $shop_link = function_exists('wc_get_page_permalink') ? esc_url(wc_get_page_permalink('shop')) : '#'; $html .= '
'; // 5. How It Works $html .= '

How It Works

1. Upload Image

2. Choose Size

3. Customize

4. Delivery

'; $html .= '
'; // End #aw-home-wrap // Init Script $html .= ''; return $html; } // =========================================================================